

package com.hazelcast.internal.config.yaml;

import com.hazelcast.internal.yaml.YamlMapping;
import com.hazelcast.internal.yaml.YamlNode;
import org.w3c.dom.DOMException;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;

/**
 * Empty {@link NamedNodeMap} implementation. Used by {@link YamlElementAdapter#getAttributes()}
 * when wrapping {@link YamlNode}s other than {@link YamlMapping}.
 */
final class EmptyNamedNodeMap implements NamedNodeMap {
    private static final NamedNodeMap INSTANCE = new EmptyNamedNodeMap();

    private EmptyNamedNodeMap() {
    }

    /**
     * Returns the singleton instance of this class
     *
     * @return an empty {@link NamedNodeMap}
     * @see #INSTANCE
     */
    static NamedNodeMap emptyNamedNodeMap() {
        return INSTANCE;
    }

    @Override
    public Node getNamedItem(String name) {
        return null;
    }

    @Override
    public Node setNamedItem(Node arg) throws DOMException {
        throw new UnsupportedOperationException();
    }

    @Override
    public Node removeNamedItem(String name) throws DOMException {
        throw new UnsupportedOperationException();
    }

    @Override
    public Node item(int index) {
        return null;
    }

    @Override
    public int getLength() {
        return 0;
    }

    @Override
    public Node getNamedItemNS(String namespaceURI, String localName) throws DOMException {
        throw new UnsupportedOperationException();
    }

    @Override
    public Node setNamedItemNS(Node arg) throws DOMException {
        throw new UnsupportedOperationException();
    }

    @Override
    public Node removeNamedItemNS(String namespaceURI, String localName) throws DOMException {
        throw new UnsupportedOperationException();
    }
}
